using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class so_exchangeorderMap : EntityTypeConfiguration<so_exchangeorder>
    {
        public so_exchangeorderMap()
        {
            // Primary Key
            this.HasKey(t => new { t.Number, t.airline__, t.airline, t.Date, t.document__ });

            // Properties
            this.Property(t => t.Number)
                .IsRequired()
                .HasMaxLength(8);

            this.Property(t => t.airline__)
                .IsRequired()
                .HasMaxLength(6);

            this.Property(t => t.airline)
                .IsRequired()
                .HasMaxLength(35);

            this.Property(t => t.Remark1)
                .HasMaxLength(100);

            this.Property(t => t.Remark2)
                .HasMaxLength(100);

            this.Property(t => t.Routing)
                .HasMaxLength(100);

            this.Property(t => t.document__)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            // Table & Column Mappings
            this.ToTable("so_exchangeorder");
            this.Property(t => t.Number).HasColumnName("Number");
            this.Property(t => t.airline__).HasColumnName("airline_#");
            this.Property(t => t.airline).HasColumnName("airline");
            this.Property(t => t.Date).HasColumnName("Date");
            this.Property(t => t.Remark1).HasColumnName("Remark1");
            this.Property(t => t.Remark2).HasColumnName("Remark2");
            this.Property(t => t.Routing).HasColumnName("Routing");
            this.Property(t => t.document__).HasColumnName("document_#");
        }
    }
}
